package com.changdu.seatunnel.admin.mapper.sql;

import java.sql.Connection;
import java.sql.Statement;

import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;


@Service
public class RepositoryMapperFactory extends RepositoryDataSource {

	private final Environment environment;
	
	public RepositoryMapperFactory(Environment environment, DataSourceProperties dataSourceProperties) {
		super(dataSourceProperties);
		this.environment = environment;
	}
	
	/**
	 * 执行 sql
	 * @throws Exception 
	 */
	public void executeSql(String sql) throws Exception {
		try (Connection connect = getConnect();Statement statement = connect.createStatement()){
			statement.execute(sql);
		} catch (Exception e) {
			throw e;
		}
	}

}